//index.js

Page({
  data: {
    logo: "",
    name: ""
  },
  onLoad() {
    wx.getSetting({
      success: res => {
        if (res.authSetting['scope.userInfo']) {
          wx.getUserInfo({
            success: res => {
              var { nickName, avatarUrl } = res.userInfo;
              this.setData({
                logo: avatarUrl,
                name: nickName
              })
            }
          })
        }
      }
    })
  },
  onGetUserInfo(e) {
    console.log(e.detail.userInfo)
    var { nickName, avatarUrl } = e.detail.userInfo;
    this.setData({
      logo: avatarUrl,
      name: nickName
    })
  }
})
